<div id="receipt_wrapper">
	<div id="receipt_header">
		<div id="company_name"><?php echo  $this->Html->image('smllogo.jpg', array('alt' => 'Pretty Little Treasures', 'border' => '0', 'width' => '180'));?></div>
		<div id="company_address">384 Centre Rd, Bentleigh VIC 3204</div>
        <div id="company_phone">Tel: (03) 9557 3388</div>
		<div id="sale_receipt">Sales Receipt</div>
		<div id="sale_time"><?php echo $this->Time->format("m/d/Y H:i",$sale["created"])?></div>
	</div>
	<div id="employee">Customer ID: <?php echo $sale["customer_id"]?></div>
	<div id="receipt_general_info">
				<div id="sale_id">Normal Sale -- <?php echo $sale["id"]?></div>
	</div>
		<table id="receipt_items">
	<tbody><tr>
	<th style="width:49%;text-align:center;">Item</th>
	<th style="width:20%;text-align:center;">Price</th>
	<th style="width:15%;text-align:center;">Discount.</th>
	<th style="width:16%;text-align:right;">Total</th>
	</tr>
		<?php if(!empty($sale["sale_item"] )){?>
		<?php foreach($sale["sale_item"] as $k=>$v){?>
		<tr>
		<td style="text-align:center;"><span class="long_name"><?php echo $v["Item"]["id"]?> -- <?php echo $v["Item"]["name"]?></span><span class="short_name"><?php echo $v["Item"]["id"]?></span></td>
		<td style="text-align:center;"><?php echo $this->Number->currency($v["Item"]["original_price"],"USD")?></td>
		<td style="text-align:center;"><?php $discount=empty($v["Item"]["discount_type"])?$v["Item"]["original_price"]*$v["Item"]["discount"]/100:$v["Item"]["discount"];
		echo $this->Number->currency($discount,"USD")?></td>
		<td style="text-align:right;"><?php echo $this->Number->currency($v["Item"]["total"],"USD")?></td>
		</tr>
		<?php }}?>
	    <tr>
	    <td colspan="2" align="center"></td>
		<td colspan="2"></td>
		<td colspan="2">&nbsp;</td>
	    </tr>
		<tr>
	<td colspan="4" style="text-align:right;">Sub Total</td>
	<td colspan="2" style="text-align:right;"><?php echo $this->Number->currency($sale["sale_item_subtotal"],"USD")?></td>
	</tr>


			<tr><td colspan="6" style="text-align:right;border-top:2px dashed #000000;">&nbsp;</td></tr>




	<?php if(!empty($sale["layby_item"] )){?>
	<tr><td>Layby Sale -- <?php echo $sale["layby_item"][0]["Item"]["layby_id"]?></td></tr>
	<th style="width:49%;text-align:center;">Item</th>
	<th style="width:20%;text-align:center;">Price</th>
	<th style="width:15%;text-align:center;">Initial payment</th>
	<th style="width:16%;text-align:right;">Amount due</th>
	<?php foreach($sale["layby_item"] as $k=>$v){?>
		<tr>
		<td style="text-align:center;"><span class="long_name"><?php echo $v["Item"]["id"]?> -- <?php echo $v["Item"]["name"]?></span><span class="short_name"><?php echo $v["Item"]["id"]?></span></td>
		<td style="text-align:center;"><?php echo $this->Number->currency($v["Item"]["original_price"],"USD")?></td>
		<td style="text-align:center;"><?php echo $this->Number->currency($v["Item"]["layby_amount"],"USD")?></td>
		<td style="text-align:right;"><?php echo $this->Number->currency($v["Item"]["total"],"USD")?></td>
		</tr>
	<?php }}?>
    <tr>
    <td colspan="2" align="center"></td>
	<td colspan="2"></td>
	<td colspan="2">&nbsp;</td>
    </tr>
	<tr>
	<td colspan="4" style="text-align:right;">Sub Total</td>
	<td colspan="2" style="text-align:right;"><?php echo $this->Number->currency($sale["layby_item_amount_subtotal"],"USD")?></td>
	</tr>
	<tr>
		<td colspan="4" style="text-align:right;">Amount Due</td>
		<td colspan="2" style="text-align:right"><?php echo $this->Number->currency($sale["layby_item_subtotal"],"USD")?></td>
	</tr>	
    <tr><td colspan="6">&nbsp;</td></tr>
	<tr>
	<td colspan="4" style="text-align:right;">Total</td>
	<td colspan="2" style="text-align:right"><?php echo $this->Number->currency($sale["total"],"USD")?></td>
	</tr>
    <tr><td colspan="6">&nbsp;</td></tr>
	</tbody></table>
	<div id="sale_return_policy">
    		<h4>Pretty Little Treasures Returns & Refund Policy</h4>
    		<p>We will provide customers with a refund for goods where an item is:</p>
    		<ul>
        		<li>Faulty, and the fault was not disclosed prior to purchase, or</li>
        		<li>Unfit for purpose, or the item doesn&#39;t do what&#39;s expected.</li>
    		</ul>
    		<p>We do not refund due to change of mind, or where customers have damaged goods by using them in a way that is not intended.</p>
    		<p><span style="text-decoration:underline;">The item must be returned within 14 days</span> in the same condition as it was sold, with shop tags attached and accompanied by proof of purchase. </p>
    		<p>Where items have a known fault, Pretty Little Treasures will detail this in the price tag so customers are aware of any damage.  Such items cannot be returned.</p>
    
    	</div>
	<div id="signature"></div>
	</div>
<button class="submit_button btn" id="print_button" onclick="print_receipt()"> Print </button>
<script type="text/javascript">
function print_receipt()
 {
	printdiv("receipt_wrapper");
 }
function printdiv(printpage)
{
var headstr = "<html><head><title></title></head><body>";
var footstr = "</body>";
var newstr = document.all.item(printpage).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr+newstr+footstr;
window.print(); 
document.body.innerHTML = oldstr;
return false;
}
</script>